﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Wpf_Examples.Views
{
    /// <summary>
    /// EffactWindow.xaml 的交互逻辑
    /// </summary>
    public partial class EffactWindow : Window
    {
        public EffactWindow()
        {
            InitializeComponent();
        }

        public double GetLength(Geometry geo)
        {
            PathGeometry path = geo.GetFlattenedPathGeometry();
            double length = 0.0;
            foreach (PathFigure pf in path.Figures)
            {
                Point start = pf.StartPoint;
                foreach (PolyLineSegment seg in pf.Segments)
                {
                    foreach (Point point in seg.Points)
                    {
                        length += (start - point).Length;
                        start = point;
                    }
                }
            }
            return length;
        }
    }
}
